<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <ul>
            <li v-for="item in list">
                <img :src="item.image_src" alt="">
            </li>
        </ul>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.0.0-alpha.1/axios.js"></script>
    <script>
        // ajax  axios  

        new Vue({
            // 元素
            el: "#app",
            // 定义的数据(状态)
            // beforeCreate  基本不使用 ( 获取不到data中定义的数据, methods中定义的方法)
             beforeCreate() {
                // console.log(this.count, this.fn)
                console.log('Vue的第一个生命周期')
            },
            // created  使用率很高
            // 可以访问到this上所有的内容($refs除外)
            created() {
                // console.log(this.count, this.fn)
                console.log('Vue的第二个生命周期')
                axios.get("https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata").then(res => {
                    this.list = res.data.message
                })  
            },
            data: {
                count: 0,
                list: []
            },
            methods: {
                fn() {
                    console.log(123)
                }
            }

        })
    </script>
</body>

</html>